﻿<!--
Majesty of Omega - The next evolution of macro management space strategy

Copyright 2007 André Claaßen

This file is protected by the terms and conditions of the
Microsoft Community License (Ms-CL 1.1), a copy of which should
have been distributed along with this software. If not,
you may find the license information at the following URL:

http://www.microsoft.com/resources/sharedsource/licensingbasics/communitylicense.mspx
-->
<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
	xmlns:Majesty_of_Omega_Geometry="clr-namespace:Majesty_of_Omega.GUI.Geometry"
    xmlns:Majesty_of_Omega_ValueConverters="clr-namespace:Majesty_of_Omega.GUI.ValueConverters"
	xmlns:Majesty_of_Omega_GUI_Controls="clr-namespace:Majesty_of_Omega.GUI.Controls"
    xmlns:Majesty_of_Omega_Parts="clr-namespace:Majesty_of_Omega.GUI.Pages.Setup.Parts"
    x:Class="Majesty_of_Omega.GUI.Pages.Setup.Step3_GameSettings"
    Style="{StaticResource PageSetupStyle}"
	WindowTitle="Setup the Game"
	Title="GameSettings" Margin="-2.1,0,0,0" 
	>
    <Page.Resources>
    	<Majesty_of_Omega_ValueConverters:FormattingStringConverter x:Key="FormattingStringConverter"/>
        <Majesty_of_Omega_ValueConverters:GalaxyConfigurationConverter x:Key="GalaxyConfigurationConverter"/>
    </Page.Resources>
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="81"/>
            <RowDefinition Height="Auto" MinHeight="186"/>
            <RowDefinition Height="0.863*"/>
            <RowDefinition Height="0.137*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" MinWidth="558"/>
            <ColumnDefinition Width="450"/>
        </Grid.ColumnDefinitions>

        <!-- Title Section ..................................................................................................... -->
        <Majesty_of_Omega_Parts:SetupTitlePart TitleString="Game Setup" Grid.ColumnSpan="2" />

        <!-- Rotating Galaxy Section ..................................................................................................... -->
        <Majesty_of_Omega_GUI_Controls:SetupPanelControl Header="Game Settings" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="1" Margin="20,0,0,0" Grid.RowSpan="1" Height="Auto">
        	<Grid VerticalAlignment="Stretch" >
        		<Grid.ColumnDefinitions>
        			<ColumnDefinition Width="0.3*"/>
        			<ColumnDefinition Width="0.5*"/>
        			<ColumnDefinition Width="0.1*"/>
        		</Grid.ColumnDefinitions>
        		<Grid.RowDefinitions>
        			<RowDefinition Height="0.205*"/>
        			<RowDefinition Height="0.487*"/>
        			<RowDefinition Height="0.308*"/>
        		</Grid.RowDefinitions>
        		<ComboBox x:Name="GalaxyConfigurationComboBox" SelectionChanged="GalaxyConfigurationComboBox_SelectionChanged"  ItemsSource="{Binding Path=GalaxyConfigurations.Galaxy, Mode=OneWay, Source={StaticResource SpreadSheetManagerDS}}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Top" Grid.IsSharedSizeScope="False" SelectedIndex="0" ToolTip="Please choose a galaxy" Height="Auto" DockPanel.Dock="Top" d:LayoutOverrides="Height" MaxDropDownHeight="351" Grid.ColumnSpan="2" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,8,0">
        			<ComboBox.ItemTemplate>
        				<DataTemplate>
        					<Grid Width="Auto" >
        						<Grid.ColumnDefinitions>
        							<ColumnDefinition Width="0.6*"/>
        							<ColumnDefinition Width="0.2*"/>
        							<ColumnDefinition Width="0.2*"/>
        						</Grid.ColumnDefinitions>
        						<TextBlock  Text="{Binding Path=Name}" />
        						<TextBlock Grid.Column="1" Text="{Binding Path=StarsProperty.total_count}" HorizontalAlignment="Right" />
        						<TextBlock Grid.Column="2" Text="Stars" Margin="14,0,0,0"/>
        					</Grid>
        				</DataTemplate>
        			</ComboBox.ItemTemplate>
        		</ComboBox>
        		<Label Content="Choose Galaxy" d:LayoutOverrides="Height" VerticalAlignment="Top" Margin="0,6,0,0" />
        		<Grid VerticalAlignment="Top" Height="Auto" Grid.ColumnSpan="3" Grid.Row="1">
        			<Grid.ColumnDefinitions>
        				<ColumnDefinition Width="0.3*"/>
        				<ColumnDefinition Width="0.3*"/>
        				<ColumnDefinition Width="0.3*"/>
        			</Grid.ColumnDefinitions>
        			<GroupBox Header="Game Difficulty" Style="{DynamicResource SubGroupBoxStyle}" d:LayoutOverrides="GridBox" Margin="8,0,8,8">
        				<StackPanel>
        					<RadioButton Content="Easy"/>
        					<RadioButton Content="Average"/>
        					<RadioButton Content="Hard"/>
        					<RadioButton Content="Impossible"/>
        				</StackPanel>
        			</GroupBox>
        			<GroupBox Header="Number of Starlanes" Style="{DynamicResource SubGroupBoxStyle}" Height="Auto" Grid.Column="1" Margin="8,0,8,8">
        				<StackPanel>
        					<RadioButton Content="Few"/>
        					<RadioButton Content="Medium"/>
        					<RadioButton Content="Many"/>
        				</StackPanel>
        			</GroupBox>
        			<GroupBox Header="Distance of star lanes" Style="{DynamicResource SubGroupBoxStyle}" Width="Auto" Height="Auto" Grid.Column="3" HorizontalAlignment="Stretch" Margin="8,0,8,8">
        				<StackPanel>
        					<RadioButton Content="Short"/>
        					<RadioButton Content="Average"/>
        					<RadioButton Content="Long"/>
        				</StackPanel>
        			</GroupBox>
        		</Grid>
        		<Label Height="Auto" Content="Number of Alien opponents" Grid.Row="2" d:LayoutOverrides="Height" VerticalAlignment="Top" Margin="0,4,0,0"/>
        		<Slider x:Name="NumberOfOpponentsSlider" Value="{Binding NumberOfOpponents}"  IsSnapToTickEnabled="True" Grid.Column="1" Grid.Row="2" TickPlacement="Both" Maximum="{Binding MaxNumberOfOpponents}" SmallChange="1"/>
        		<TextBlock Grid.Column="2" Grid.Row="2" Text="{Binding Path=Value, Converter={StaticResource FormattingStringConverter}, ConverterParameter=\{0\} Aliens, ElementName=NumberOfOpponentsSlider, Mode=OneWay}" TextWrapping="Wrap" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="8,7,0,0"/>
        	</Grid>
        </Majesty_of_Omega_GUI_Controls:SetupPanelControl>

		<Majesty_of_Omega_GUI_Controls:SetupPanelControl Grid.Row="2" Header="Actual Galaxy" Margin="20,8,0,0" Location="Bottom">
		        		<Border Width="Auto" Height="Auto" Background="#FF000000" DockPanel.Dock="Bottom" x:Name="Viewport3DBorder" HorizontalAlignment="Stretch" Grid.Row="1" Grid.ColumnSpan="2">
        			<Viewport3D Height="Auto" OpacityMask="#FFFFFFFF" Width="Auto">
        				<Viewport3D.Triggers>
        					<EventTrigger RoutedEvent="FrameworkElement.Loaded">
        						<BeginStoryboard>
        							<Storyboard>
        								<DoubleAnimation 
        									Storyboard.TargetName="MyGalaxyAngleRotation"
        									Storyboard.TargetProperty="Angle"
        									From="0" To="360" Duration="0:0:10"
        									RepeatBehavior="Forever" />
        								<DoubleAnimation 
        									Storyboard.TargetName="MyGalaxy3D"
        									Storyboard.TargetProperty="Angle"
        									From="0" To="-360" Duration="0:0:10"
        									RepeatBehavior="Forever" />
        							</Storyboard>
        						</BeginStoryboard>
        					</EventTrigger>
        				</Viewport3D.Triggers>

        				<Viewport3D.Camera>
        					<!--<PerspectiveCamera FieldOfView="45" FarPlaneDistance="100" LookDirection="0,0,-3.4142135623731" NearPlaneDistance="0.1" Position="0,0,3.4142135623731" UpDirection="0,1,0"/>-->
        					<PerspectiveCamera x:Name="Camera" FieldOfView="45"  Position="0,0,100" LookDirection="0,0,-100" />
        				</Viewport3D.Camera>
        				<!-- The ModelVisual3D children contain the 3D models -->
        				<!-- This ModelVisual3D defines the light cast in the scene. Without light, the 3D 
                           object cannot be seen. Also, the direction of the lights affect shadowing. If desired,
                           you can create multiple lights with different colors that shine from different directions. -->
        				<ModelVisual3D x:Name="GalaxyModel">
        					<ModelVisual3D.Transform>
        						<Transform3DGroup>
        							<TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="0"/>
        							<ScaleTransform3D ScaleX="0.1" ScaleY="0.1" ScaleZ="0.1"/>
									<RotateTransform3D >
        								<RotateTransform3D.Rotation>
        									<AxisAngleRotation3D x:Name="MyGalaxyAngleRotation"  />
        								</RotateTransform3D.Rotation>
        							</RotateTransform3D>
        						</Transform3DGroup>
        					</ModelVisual3D.Transform>
        					<ModelVisual3D>
        						<ModelVisual3D.Content>
        							<AmbientLight Color="#FFFFFFFF"/>
        						</ModelVisual3D.Content>
        					</ModelVisual3D>
        					<Majesty_of_Omega_Geometry:Galaxy3D x:Name="MyGalaxy3D" ScaleAdjust="0.25" Galaxy="{Binding Path=SelectedValue, Converter={StaticResource GalaxyConfigurationConverter}, ElementName=GalaxyConfigurationComboBox, Mode=Default}"/>
        				</ModelVisual3D>
        			</Viewport3D>
        		</Border>

		</Majesty_of_Omega_GUI_Controls:SetupPanelControl>

        <!-- Right Stack with decoration Picture ............................................................................... -->
        <Majesty_of_Omega_Parts:RaceInfoPart x:Name="RaaceInfo" Grid.Column="1" Grid.Row="1"  Margin="17.8,0,0,0" Grid.RowSpan="2" />
        <Majesty_of_Omega_GUI_Controls:NavigationPanel ClickForward="NavigationPanel_ClickForward" VerticalAlignment="Bottom" Grid.Row="3" Grid.ColumnSpan="2"/>
    </Grid>
</Page>
